﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Devonline.Core;
using Devonline.Entity;

namespace Devonline.Identity
{
    /// <summary>
    /// 身份通用抽象基类
    /// </summary>
    public abstract class Identity<TKey> : EntitySetWithCreateAndUpdate<TKey>, IIdentity<TKey> where TKey : IConvertible
    {
        /// <summary>
        /// 名称
        /// </summary>
        [Column("name"), Required, Unique, MaxLength(128), DisplayName("名称")]
        public virtual string Name { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>
        [Column("alias"), MaxLength(36), DisplayName("昵称")]
        public virtual string Alias { get; set; }
        /// <summary>
        /// 头像
        /// </summary>
        [Column("image"), MaxLength(128), DisplayName("头像")]
        public virtual string Image { get; set; }
        /// <summary>
        /// 身份类型
        /// </summary>
        [Column("type", TypeName = "VARCHAR(16)"), DisplayName("身份类型"), DefaultValue(IdentityType.Internal), Excel]
        public virtual IdentityType Type { get; set; }
    }
}
